package com.suanfa.sort;

import java.util.Arrays;
import java.util.Random;

/**
 * Created by buguniao on 16/2/10.
 */
public abstract class SuanFaTemplate {

    public abstract long run(double[] arr);

    public  void exchange(double[] arr,int idx1,int idx2){
        double tmp = arr[idx1];
        arr[idx1]=arr[idx2];
        arr[idx2]=tmp;
    }
    public boolean less(double a,double b){
        return a<b;
    }

    public boolean more(double a,double b){
        return a>b;
    }

    public double[] getRandomArray(int size){
        double[] arr =new double[size];
        //Random random = new Random(System.currentTimeMillis());;
        for(int i=0;i<arr.length;i++){
//            arr[i]= random.nextDouble();
            arr[i]=Math.floor(Math.random()*100);
        }
//        System.out.println(Arrays.toString(arr));
        return arr;
    }
}
